using System.Data.Linq.Mapping;
namespace RomanJendrusz.Amazon.ETL.Infrastructure.DataBase
{
    public class FileMappingSourceBuilder : IMappingSourceBuilder
    {
        private string file;
        private object sync = new object();
        private XmlMappingSource mappingSource;


        public FileMappingSourceBuilder(string file)
        {
            this.file = file;
        }

        #region IMappingSourceBuilder Members

        public MappingSource MappingSource
        {
            get
            {
                if (mappingSource == null)
                {
                    lock (sync)
                    {
                        mappingSource = XmlMappingSource.FromUrl(file);
                    }
                }
                return mappingSource;
            }
        }


        #endregion
    }
}